<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>lesson 12</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>

<body>
    <div id="root"></div>
</body>

</html>
<script>
    // 第二章  Vue 基础语法/2-12 事件绑定(1)
    // 事件修饰符分别有：stop，prevent，capture，self，once，passive
    const app = Vue.createApp({
        data() {
            return {
                counter: 0
            };
        },
        methods: {
            handleDinfClick(){
                alert('div click');
            },
            handleBtnClick() {
                this.counter++;
            }
        },
        template: `
        <div>
           <div @click.self="handleDinfClick">
                {{counter}}
                <button @click="handleBtnClick">+</button>
            </div>
        </div>
        `
    });
    const vm = app.mount('#root')
</script>